<%@ page contentType="text/html;charset=utf-8" language="java"
	pageEncoding="UTF-8" import="java.util.Date"%>
<!DOCTYPE html>
<html lang="en">
  <head>
     <%@include file="/WEB-INF/jsp/common/style.jsp"%>
       
     
  </head>
  <body>
    <div id="wrap">
    
	<form class="form-horizontal"  id="seachform" action="${pageContext.request.contextPath}/set/childnode/index"	method="post">
	<input  type="hidden" name="catId" />
	<input type="hidden" name="catLevel" />
    <div   class="container-fluid">
     
      <!-- Main window -->
      <div class="main_container" id="dashboard_page">

		 <div class="row-fluid">
          <div class="widget widget-padding span12">
            <h4 class="widget-head-title">产品节点设置</h4>
									<div class="widget-header">
										<span>首页&nbsp;>&nbsp;产品节点设置</span>
			</div>
		  <div class="row-fluid" style="background-color:#fff;padding:20px 20px;">
              <div class="table-scroll">
				  <table   style="line-height: 40px; text-align: left;padding:20px 20px" >
					  <tr>

						  <td width="70px">产品节点:</td>
						  <td>
							  <select  name="nodeId"  id="nodeId" type="select"  class="">
								  <option value="" <c:if test="${model.nodeId==null}">selected="selected"</c:if>>全部</option>
								  <c:forEach items="${model.nodes}" var="lo" varStatus="itemStatus">
									  <option value="${lo.id}" <c:if test="${model.nodeId==lo.id}">selected="selected"</c:if>>${lo.nodeName}</option>
								  </c:forEach>
							  </select>
						  </td>
						  <td width="80px">子节点名称:</td>
						  <td><input name="childNodeName" value="${model.childNodeName}"  type="text" class=""/></td>
						  <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					  </tr>


				  </table>

			  </div></div>
       </div>
      </div>
      
       <div class="row-fluid">
      		<div>
               <input class="btn btn-primary" type="submit" value="查询"/>          
               <input class="btn btn-success buttonrole" type="button"  name="btnadd" value="新增" onclick="edit('')"/>
			</div>
		</div>
		<div class="row-fluid">
          <div class="widget widget-padding span12">
            <div class="widget-header">
              <i class="icon-group"></i>
              <h5>查询结果</h5>
            
            </div>  
            <div class="widget-body">
              <table id="users" class="table table-striped table-bordered dataTable">
                <thead>
                  <tr>
                   <th>产品节点</th>
                   	<th>子节点名称</th>
                   	<th>信息必填</th>
                   	<th>变更影响后续流程</th>
                   	<th>创建人</th>
                   	<th>创建时间</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <c:forEach items="${model.items}" var="item" varStatus="itemStatus">
                    	<tr  id="row_${item.id}">   
                    		<td>${item.parent_name}</td>   
                    		<td>${item.node_name}</td>   
                    		 <c:choose>
								<c:when test="${item.is_required == 1}">
										<td  align="center" class="cdr fw7">是 </td> 
								</c:when>							
								<c:otherwise>
									<td  align="center" class="cdr fw7">否</td> 
								</c:otherwise>
								</c:choose> 
							<c:choose>
								<c:when test="${item.is_effect_child == 1}">
										<td  align="center" class="cdr fw7">是 </td> 
								</c:when>							
								<c:otherwise>
									<td  align="center" class="cdr fw7">否</td> 
								</c:otherwise>
								</c:choose>  
                    		<td>${item.create_user_name}</td> 
                    		 <td><fmt:formatDate value="${item.create_time}"  type="both" pattern="yyyy-MM-dd HH:mm:ss"/></td>   
                      		
							<td align="center" align="center" >  					
				                <a  href="javascript:edit('${item.id}');" name="btnedit"  class="buttonrole" style="margin-left: 5px"  >编辑</a>   
				                                            						 			               
				              	<a  href="javascript:del('${item.id}');"  name="btndel" class="buttonrole" style="margin-left: 5px"  >删除</a>								 
				                                            				                                                                                           
                                </td>          
                            </tr>
                    	</c:forEach>                              
                  </tr>
                 
                </tbody>
              </table>
            </div> <!-- /widget-body -->
             <div class="pagin" class="widget-footer">
             	<vp:pages  cpage="${model.cpage}"  totalCount="${model.totalCount}"  pageSize="${model.pageSize}"   />
   			</div>   
          </div> <!-- /widget -->
        </div> <!-- /row-fluid -->    
      <!-- /Main window -->
      
    	</div>
    </div>
    </form>
    </div><!-- wrap ends-->
	
  	<div id="edit" style="display:none;width: 100%;height: 100%;overflow:hidden;position:absolute;left:0;top:0;right:0;bottom:0;">
        <iframe id="editFrame" width="100%" height="100%"  frameborder="0" border="0" scrolling="auto"></iframe>
    </div>
   
  </body>
  <script type="text/javascript">
	function seach(){
		$("#cpage").val(1);
		oksubmit();
	}
	function oksubmit() {
	    $("#btnOk").attr("disabled", "disabled");	  
	    var objform = document.getElementById('seachform');
	    objform.submit();
	}	
	function del(id){		
		layer.confirm('确认要删除此项目吗', {
			  title :'确认删除',
			  btn: ['确认','取消'] //按钮
			}, function(){
				sendOpTo(id);
			}, function(){
			  
			});			
	}
	function sendOpTo(id){
		layer.load(1, {shade: [0.5,'#fff']});
		var postData="projectId=" + id;
		 $.ajax({
	            type: "POST",
	            url: "del",
	            data: postData,
	            contentType: "application/x-www-form-urlencoded;charset=UTF-8",
	            async: true, // 同步  true 异步。默认是异步
	            dataType: 'json',
	            error: function(resultdata) {
	            	layer.closeAll();
	            },
	            success: function(resultdata) {
	            	layer.closeAll();
	                if(resultdata.returnCode=="0000"){               	
	                	layer.alert('操作成功',{icon: 1}, function(){
	                		layer.closeAll();
	                	 	 oksubmit();
	                	});
	                }else{
	                	layer.alert(resultdata.returnMessage);
	                }
	            }
	        });
	}
	
    function editReturn() {
       layer.closeAll();
       oksubmit();
    }
    function closeAll() {
        layer.closeAll();
     }
    function edit(id){
		var domainUrl="edit?childNodeId=" + id;
		layer.open({
			  type: 2,
			  title: '项目',
			   area: ['850px', '590px'],
			   content: domainUrl //iframe的url
			 }); 
	}
	
	</script>
</html>
